package com.ruoyi.common.config;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;

public class UniNameGenrator extends AnnotationBeanNameGenerator {
    @Override
    public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
        String beanName = definition.getBeanClassName();
        String className = beanName.substring(beanName.lastIndexOf(".") + 1);
        // 权限控制bean类不需要全路径类名作为bean名
        if("PermissionService".equalsIgnoreCase(className)){
            return "ss";
        }
        return beanName;
    }
}
